package com.software.form.billform.dao;

import java.util.List;

public class BillFormTransaction {

	private BillFormDao billFormDao;

	public BillFormDao getBillFormDao() {
		return billFormDao;
	}

	public void setBillFormDao(BillFormDao billFormDao) {
		this.billFormDao = billFormDao;
	}
	
	public boolean add(String no,String company,String consigneeName,String consigneeAddress,String depositBank,String account,
			String vesselName,String voyage,String loadingPort,String destinationPort,String deliverPrivision,String oceanFrieight,
			String unloadingPlace,String arrivalDate,String intoYardDate, 
			String markAndNo,String cargoName,String quantity,String weight,String volume,String sagentEmail){
			BillForm bf = new BillForm();
			bf.setNo(no);
			bf.setCompany(company);
			bf.setConsigneeName(consigneeName);
			bf.setConsigneeAddress(consigneeAddress);
			bf.setDepositBank(depositBank);
			bf.setAccount(account);
			bf.setVesselName(vesselName);
			bf.setVoyage(voyage);
			bf.setLoadingPort(loadingPort);
			bf.setDestinationPort(destinationPort);
			bf.setDeliverPrivision(deliverPrivision);
			bf.setOceanFrieight(oceanFrieight);
			bf.setUnloadingPlace(unloadingPlace);
			bf.setArrivalDate(arrivalDate);
			bf.setIntoYardDate(intoYardDate);
			bf.setMarkAndNo(markAndNo);
			bf.setCargoName(cargoName);
			bf.setQuantity(quantity);
			bf.setWeight(weight);
			bf.setVolume(volume);
			bf.setSagentEmail(sagentEmail);
		return billFormDao.add(bf);
	}
	
	public List<BillForm> getBills(String shipperEmail){
		return billFormDao.queryByShipperEmail(shipperEmail);
	}
	
	public BillForm getBillByNo(String no){
		return billFormDao.queryByNo(no);
	}
	
	public boolean updateShipperEmail(String no,String email){
		return billFormDao.updateShipperEmailByNo(no, email);
	}
	
	public List<BillForm> getBillsBySagentEmail(String email){
		return billFormDao.queryByEmail(email);
	}
}
